The INPUT element is used for a wide variety of different kinds of entry fields within HTML fill- out forms. The TYPE attribute determines the type of field.
ID
An SGML identifier used as the target for hypertext links or for naming particular elements in
associated style sheets. Identifiers are NAME tokens and must be unique within the scope of the current
document.
LANG
This is one of the ISO standard language abbreviations, e.g. "en.uk" for the variety of
English spoken in the United Kingdom. It can be used by parsers to select language specific choices for
quotation marks, ligatures and hyphenation rules. The language attribute is composed from the two letter
language code from ISO 639, optionally followed by a period and a two letter country code from ISO
3166.
CLASS
This a space separated list of SGML NAME tokens and is used to subclass tag names. By
convention, class names are interpreted hierarchically, with the most general class on the left and the most
specific on the right, where classes are separated by a period. The CLASS attribute is most commonly used
to attach a different style to some element, but it is recommended that where practical class names should be
picked on the basis of the element's semantics, because this permitsother uses, such as restricting search
through documents by matching on element class names. The conventions for choosing class names are
outside the scope of this document.
TYPE
Defines the type of the field as one of: TEXT, PASSWORD, CHECKBOX, RADIO, RANGE,
FILE, SCRIBBLE, HIDDEN, SUBMIT, IMAGE or RESET. It defaults to TEXT. The attribute value is an
SGML name token and and as such is case insensitive.
NAME
This provides a character string used to name the field when submitting the form's data. Several
fields may share the same name, for instance a group of radio buttons or checkboxes. The name is case
insensitive.
VALUE
This is a character string or number which is used to initialize text, range and hidden fields.
DISABLED When present, the field should be rendered as normal, but can't be modified by the user. Where practical the rendering should provide a cue that the field is disabled e.g. by graying out the text, changing the color of the background or similar.
ERROR
This attribute specifies an error message explaining why the field's current value is incorrect. When
this attribute is missing, the field can be assumed to be ok. User agents are recommended to provide a cue to
indicate that the field is in error.
CHECKED
The presence of this attribute indicates that a radio button or checbox should be initialized to its
selected state.
SIZE
This specifies the visible width of a text or password field. For fixed pitch fonts, the size attribute
specifies the maximum number of characters visible, while for variable pitch fonts, the attribute specifies the
width in en units (half the point size).
MAXLENGTH
Specifies the maximum number of characters permitted for text and password fields.
MIN
This is an integer or real number and specifies the lower bound for a range field.
MAX
This is an integer or real number and specifies the upper bound for a range field.
ACCEPT
A comma separated list of MIME content types for use in restricting the types of files that can be
attached to a form with a file field.
SRC (Source)
The SRC attribute specifies the URI for an image for use as the background of a SCRIBBLE,
IMAGE, SUBMIT or RESET field. Its syntax is the same as that of the HREF attribute of the <A>
tag.
MD
Specifies a message digest or cryptographic checksum for the associated image specified by the
SRC attribute. It is used when you want to be sure that the image is indeed the same one that the author
intended, and hasn't been modified in any way. For instance,
MD="md5:jV2OfH+nnXHU8bnkPAad/mSQlTDZ" specifies an MD5 checksum encoded as a
base64 character string. The MD attribute is generally allowed for all elements which support URI based
links.
ALIGN
This attribute only applies to fields with background images, i.e. SCRIBBLE, IMAGE, SUBMIT
or RESET fields. It is intended to provide the same positional control as for the IMG element. The ALIGN
attribute takes the values TOP or MIDDLE or BOTTOM, defining whether the top or middle or bottom of
the field should be aligned with the baseline for the text line in which the INPUT element appears.
With ALIGN=LEFT, the field will float down and over to the current left margin, and subsequent
text will wrap around the right hand side of the field. Likewise for ALIGN=RIGHT, the field aligns with the
current right margin and, and text wraps around the left.
<INPUT> is legal within:
<FORM>
The following markup can be used within <INPUT>
none
Please see the Fill In Forms tutorial for examples.